<div class="layui-header header">
  <div class="layui-main">
    <a class="logo" href="{{ route('root') }}">
      <h1>LaraBBS</h1>
    </a>
    <div class="layui-form component" lay-filter="LAY-site-header-component"></div>
    <ul class="layui-nav layui-layout-left" lay-filter="">
      <li class="layui-nav-item {{ active_class(if_route('topics.index'), 'layui-this') }}"><a href="{{ route('topics.index') }}">话题</a></li>
      <li class="layui-nav-item {{ category_nav_active(1) }}"><a href="{{ route('categories.show',1) }}">分享</a></li>
      <li class="layui-nav-item {{ category_nav_active(2) }}"><a href="{{ route('categories.show',2) }}">教程</a></li>
      <li class="layui-nav-item {{ category_nav_active(3) }}"><a href="{{ route('categories.show',3) }}">问答</a></li>
      <li class="layui-nav-item {{ category_nav_active(4) }}"><a href="{{ route('categories.show',4) }}">公告</a></li>
    </ul>
    <ul class="layui-nav layui-layout-right" lay-filter="">
      @guest
        <li class="layui-nav-item"><a href="{{ route('login') }}">登录</a></li>
        <li class="layui-nav-item"><a href="{{ route('register') }}">注册</a></li>
      @else
        <li class="layui-nav-item">
          <a href="{{ route('topics.create') }}"><i class="fa fa-plus"></i></a>
        </li>
        <li class="layui-nav-item">
          <a href="{{ route('notifications.index') }}">消息<span class="layui-badge">{{ Auth::user()->notification_count }}</span></a>
        </li>
        <li class="layui-nav-item">
          <a href="javascript:;">
            <img src="{{Auth::user()->avatar}}" class="layui-nav-img">
            {{ Auth::user()->name }}
          </a>
          <dl class="layui-nav-child">
            <dd><a href="{{route('users.show', Auth::user())}}">个人中心</a></dd>
            <dd><a href="{{route('users.edit', Auth::user())}}">编辑资料</a></dd>
            <hr>
            <dd style="text-align: center;">
              <a href="#">
                <form action="{{ route('logout') }}" method="POST">
                  {{ csrf_field() }}
                  <button class="layui-btn layui-btn-sm layui-btn-danger" type="submit">退出</button>
                </form>
              </a>
            </dd>
          </dl>
        </li>
      @endif
    </ul>
  </div>
</div>


